package testJdk.io.buffered;

import java.io.*;

public class TestFileCopy3 {
    public static void main(String[] args) {
        // 1.创建输入流和输出流
        try (BufferedReader br = new BufferedReader(new FileReader("D:\\readme.txt"));
             BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\readme2.txt"))
        ) {// 2.使用流完成文件的复制(按行)
            String str = br.readLine();
            while (str != null) {
                bw.write(str);
                //bw.write("\r\n");
                bw.newLine();
                str = br.readLine();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        // 3.关闭输入流和输出流
        // br.close();
        // bw.close();
    }
}